const User = require("../model/User");

async function handleRegister(userInfo = {}) {
  const newUser = await User.create(userInfo);
  return newUser;
}

async function handleLogin(loginIfo = {}) {
  const newlogin = await User.findOne(loginIfo);
  if (newlogin != null) {
    return newlogin;
  } else {
    return false;
  }
}

module.exports = { handleRegister, handleLogin };
